import numpy as np
import tensorflow as tf
bfloat16 = tf.bfloat16.as_numpy_dtype
dtype_emu = {bfloat16: 0, np.float16: 1, np.float32: 2, np.int8: 3, np.int16: 4, np.int32: 5}

def gen_golden_data_simple():

    # dtype = bfloat16
    # dtype = np.int8
    dtype = np.float16

    input_shape = [16, 1200]

    x = np.random.uniform(1, 1, input_shape).astype(dtype)
    y = np.random.uniform(1, 1, input_shape).astype(dtype)

    z = np.sum(np.multiply(x, y)).astype(dtype)

    golden = np.zeros(input_shape, dtype=dtype)
    golden[0, 0] = z
    print(z)

    tiling = np.array([input_shape[0] * input_shape[1], dtype_emu[dtype]], dtype=np.uint32)
    tiling.tofile("./input/input_tiling.bin")
    x.astype(dtype).tofile("./input/input_x.bin")
    y.astype(dtype).tofile("./input/input_y.bin")
    golden.tofile("./output/golden.bin")


if __name__ == "__main__":
    gen_golden_data_simple()
